#pragma once
#include <string>
#include <vector>
#include "PathNode.h"
#include <stack>
//#include "StaticObject.h"

class Graph
{
public:
	/*static const int ROUTE_DISTANCE_SHORT = 1<<0; //0
	static const int ROUTE_DISTANCE_LONG = 1<<1;  //1
	static const int ROUTE_COVER_SEEK = 1<<2;  //2
	static const int ROUTE_COVER_AVOID = 1<<3;    //4*/

	Graph(void);
	~Graph(void);

	static Graph* getInstance();
	void destroy(void);

	PathNode* addNode(const std::string& name, Ogre::Vector3 pos,Ogre::SceneManager* pSceneMgr);
	void connect(PathNode* pLeft, const std::string& right, Ogre::SceneManager* pSceneMgr = NULL);
	PathNode* findRandomNode(void);
	PathNode* findNode(const std::string& secondName);
	bool findPath(const std::string& start, const std::string& end, std::stack<PathNode*>* pPath);
	bool findPath(PathNode* pStart, PathNode* pEnd, std::stack<PathNode*>* pPath);
	void reset(void);
	//void calculateExposures(std::vector<StaticObject*>* pObjects, Ogre::SceneManager* pSceneMgr);

private:
	float calculateCost(PathNode* pNode, Edge* pEdge);
	bool inList(PathNode* pNode, std::vector<PathNode*>* pList);
	static bool compareNodes(PathNode* pFirst, PathNode* pSecond);

	std::vector<PathNode*> mNodes;
};